<template>
  <div>
    {{ floorList.length }}
    <div
      v-for="(floorItem, floorIndex) in floorList"
      :key="floorIndex"
      class="item"
    >
      <template v-if="floorItem.type == 6">
        <div class="seckill">
          <seckill
            :seckilltabList="floorItem.hotSaleCampaign.hotSaleCampaignTabList"
            :seckillData="obj"
          />
        </div>
      </template>
    </div>
  </div>
</template>

<script>
import seckill from './seckill';
import { floorData1 } from '@/views/superBrand/json/superBrand-1769';
export default {
  name: 'index',
  components: {
    seckill
  },
  data() {
    return {
      floorList: [],
      obj: {
        floorId: 8336,
        type: 2,
        id: 175,
        mshopLinkData: '',
        floorName: '秒杀',
        hotSaleName: 'dd'
      }
    };
  },
  mounted() {
    this.getData();
  },
  methods: {
    getData() {
      setTimeout(() => {
        const { data: floorData } = floorData1 || {};
        if (floorData) {
          floorData.forEach(item => {
            // 楼层类型 type 1:顶部导航 2:banner 3:直播 4:优惠券 5:资源位 6:活动模块 7:频道 8:猜你喜欢
            const {
              id: floorId,
              type,
              hotSaleNavList,
              hotSaleChannel,
              hotSaleResourceRes,
              hotSaleLive,
              hotSaleCampaign,
              hotSaleHighPopular,
              hotSaleBannerList,
              hotSaleSp
            } = item || {};
            if (type === 1) {
              this.NavTabdata = hotSaleNavList || [];
            } else if (type === 7) {
              let { showType: channelNavShowType, hotSaleChannelDetailList } =
                hotSaleChannel || {};
              // showType: 1:常规 2:左侧
              this.channelNavShowType = channelNavShowType;
              const channelList = hotSaleChannelDetailList || [];
              this.channelList = channelList.map(vItem => {
                vItem.floorId = floorId;
                return vItem;
              });
              item.floorImg = hotSaleChannel.floorImg || '';
              item.mshopLinkData = hotSaleChannel.mshopLinkData || '';
              this.handleChannelListData({ floorId, hotSaleChannelDetailList });
            } else if (type == 3) {
              item.floorImg = hotSaleLive.floorImg || '';
              item.mshopLinkData = hotSaleLive.mshopLinkData || '';
            } else if (type == 6) {
              item.floorImg = hotSaleCampaign.floorImg || '';
              item.mshopLinkData = hotSaleCampaign.mshopLinkData || '';
              item.seckillBaseInfo = {
                floorId: item.id,
                type: hotSaleCampaign.type,
                id: hotSaleCampaign.id,
                mshopLinkData: hotSaleCampaign.mshopLinkData,
                floorName: item.name,
                hotSaleName: this.hotSaleName
              };
            } else if (type == 5) {
              item.floorImg = hotSaleResourceRes.floorImg || '';
              item.mshopLinkData = hotSaleResourceRes.mshopLinkData || '';
            } else if (type == 9) {
              item.floorImg = hotSaleHighPopular.floorImg || '';
              item.mshopLinkData = hotSaleHighPopular.mshopLinkData || '';
            } else if (type == 2) {
              item.floorImg = hotSaleBannerList.floorImg || '';
              item.mshopLinkData = hotSaleBannerList.mshopLinkData || '';
            } else if (type == 4) {
              item.floorImg = hotSaleSp.floorImg || '';
              item.mshopLinkData = hotSaleSp.mshopLinkData || '';
            }
          });
          let arr = [...this.floorList, ...floorData];
          this.floorList = arr.filter(v => v.type != 1);
          if (this.floorList.length == 0 && this.floorIdArr.length > 1) {
            this.floorIndex += 1;
            this.getFloorInfo();
          }
        }
      }, 1000);
    }
  }
};
</script>

<style scoped></style>
